﻿using MediatR;
using T_vehicle.API.Application.Command.RepairRecordsCommand;
using T_vehicle.Infrastructure.Interfacec;

namespace T_vehicle.API.Application.CommandHandlers.RepairRecordsCommandHandlers
{
    public class DelRepairRecordsCommandHandlers:IRequestHandler<DelRepairRecordsCommand,int>
    {
        private readonly IRepairRepository repairRepository;

        public DelRepairRecordsCommandHandlers(IRepairRepository repairRepository)
        {
            this.repairRepository = repairRepository;
        }

        public async Task<int> Handle(DelRepairRecordsCommand request, CancellationToken cancellationToken)
        {
            var list = await repairRepository.GetModelAsync(request.RepairRecordsId);
            list.IsDel = true;
            var res= await repairRepository.UpdateAsync(list);
            return res;
        }
    }
}
